﻿@using System.Configuration
@using System.Web.Configuration
@using KPIS.GERP.WEB.GAMS.Class
@using KPIS.GERP.Models
@model KPIS.GERP.Models.SYS.ViewModel.LoginModel 

@{
	Layout = null;
} 
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>ลงชื่อเข้าใช้ [@GimsConfigReader.LoginMainTitle]</title>

		<meta name="description" content="User login page" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
        
	<!--basic styles-->
<link href="/Content/Ace/assets/css/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/bootstrap-responsive.min.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/font-awesome.min.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/datepicker.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/daterangepicker.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/chosen.css" rel="stylesheet" />
<link href="/Content/Ace/assets/css/prettify.css" rel="stylesheet" />
<!--[if IE 7]>
	<link rel="stylesheet" href="/Content/Ace/assets/css/font-awesome-ie7.min.css" />
<![endif]-->
<!--page specific plugin styles--> 
	
<!--fonts-->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" />
<!--ace styles-->
<link rel="stylesheet" href="/Content/Ace/assets/css/ace.min.css" />
<link rel="stylesheet" href="/Content/Ace/assets/css/ace-responsive.min.css" />
<link rel="stylesheet" href="/Content/Ace/assets/css/ace-skins.min.css" />
<!-- gerp stylesheet -->
<link rel="stylesheet" href="/Content/Site.css" />
<!--[if lte IE 8]>
	<link rel="stylesheet" href="/Content/Site-ie.css" />
	<link rel="stylesheet" href="/Content/Ace/assets/css/ace-ie.min.css" />
<![endif]-->


	</head>

	<body class="login-layout loginlayout-additional">
		<div class="container-fluid" id="main-container">
			<div id="main-content">
                <div>
                    
                    <div class="row-fluid">
                        <div class="left"> 
                            <div class="span4 right" style=" text-align: right;">
                                <img src="@Url.Content(GimsConfigReader.LoginLogoPath)" style="margin-top: 11px" />
                            </div>
                            <div class="span8" style=" margin-left: 0px;">
                                <h1 class="loginlayout-title">
                                    @*i class="icon-white icon-inbox"></i>*@
                                    <span class="red" style="vertical-align: text-bottom">
                                        @GimsConfigReader.LoginMainTitle
                                    </span>
                                </h1>
                                <h4 class="blue loginlayout-subTitle" >@GimsConfigReader.LoginSubTitle</h4>
                                <h5 class="pink" style="margin-top: 1px; font-style:italic">@GimsConfigReader.LoginThirdTitle</h5>
                            </div> 
                        </div>
                    </div> 
                </div>
				<div class="row-fluid">
					<div class="span12">
						<div class="login-container">
							<br />
							<br />
							<br />
							<div class="space-6"></div>

							<div class="row-fluid">
								<div class="position-relative">
									<div id="login-box" class="visible widget-box no-border">@*class="visible widget"*@
                                        
										<div class="widget-body">
											<div class="widget-main">
												<h4 class="header blue lighter bigger">
													<i class="icon-hand-right"></i>
													กรอกข้อมูลเพื่อเข้าระบบ
												</h4>
												<div class="space-6"></div>

												@using (Html.BeginForm())
			{
                
													@Html.AntiForgeryToken()
    
													<label>
														<span class="block input-icon input-icon-right">
															@Html.TextBoxFor(m => m.UserName, new { @class = "span12", @placeholder = "ชื่อเข้าใช้" })
															@* <input type="text" class="span12" placeholder="Username" /> *@
															<i class="icon-user"></i>
														</span>
													</label>

													<label>
														<span class="block input-icon input-icon-right">
															@Html.PasswordFor(m => m.Password, new { @class = "span12", @placeholder = "รหัสผ่าน" })
															@*<input type="password" class="span12" placeholder="Password" />*@
															<i class="icon-lock"></i>
														</span>
													</label>
                                                        
				if (ViewData.ModelState.IsValid == false)
				{

														<div class="alert alert-error">
															<button type="button" class="close" data-dismiss="alert">
																<i class="icon-remove"></i>
															</button>
															<strong>
																<i class="icon-remove"></i>
																ไม่สามารถเข้าใช้ระบบได้
															</strong>
															@Html.ValidationSummary()
														</div>
				}

													<div class="space"></div>

													<div class="row-fluid">
														<label class="span8">
															<input type="checkbox" name="RememberMeChb" id="RememberMeChb" />
															@*<input type="checkbox" />*@
															<span class="lbl"> ลงชื่อเข้าใช้อัตโนมัติ</span>
														</label>

														<button class="span4 btn btn-small btn-primary" onclick="submit()">
															<i class="icon-key"></i>
															เข้าใช้
														</button>
													</div>
                <br />
                
                // บอกเวอร์ชั่นของ Code เพื่อใช้ในการเทสระบบ
                var entryAssembly = typeof(KPIS.GERP.WEB.GAMS.Class.GimsConfigReader).Assembly;//System.Reflection.Assembly.GetEntryAssembly();
                var fileInfo = new FileInfo(entryAssembly.Location);
                var buildDate = fileInfo.LastWriteTime;
                <div style="background-color:turquoise;font-size: x-large">
                   โค้ดนี้ปรับปรุงล่าสุดเมื่อ<br/><b style="color:blue">@buildDate </b>
                </div>
                //!- บอกเวอร์ชั่นของ Code เพื่อใช้ในการเทสระบบ
                                                 
            }
											</div><!--/widget-main-->

											<div class="toolbar clearfix">
												<div>
													<a href="#" onclick="show_box('forgot-box'); return false;" class="forgot-password-link">
														<i class="icon-arrow-left"></i>
														ลืมรหัสผ่าน
													</a>
												</div>
                                                 
											</div>
										</div><!--/widget-body-->
									</div><!--/login-box-->

									<div id="forgot-box" class="widget-box no-border">
										<div class="widget-body">
											<div class="widget-main">
												<h4 class="header red lighter bigger">
													<i class="icon-key"></i>
													รับข้อมูลรหัสผ่าน
												</h4>

												<div class="space-6"></div>
												<p>
													กรอกอีเมล์ที่ใช้รับข้อมูลรหัสผ่าน
												</p>

												<form>
													<label>
														<span class="block input-icon input-icon-right">
															<input type="email" class="span12" placeholder="Email" />
															<i class="icon-envelope"></i>
														</span>
													</label>

													<div class="row-fluid">
														<button onclick="return false;" class="btn btn-small btn-danger">
															<i class="icon-lightbulb"></i>
															ส่งมายังฉัน!
														</button>
													</div>
												</form>
											</div><!--/widget-main-->

											<div class="toolbar center">
												<a href="#" onclick="show_box('login-box'); return false;" class="back-to-login-link">
													กลับหน้าเข้าใช้ระบบ
													<i class="icon-arrow-right"></i>
												</a>
											</div>
										</div><!--/widget-body-->
									</div><!--/forgot-box-->
                                </div><!--/position-relative-->
                            </div>
                        </div>
                    </div><!--/span-->
                </div><!--/row-->
            </div>
             
            <div style="margin-top: 420px;"></div>
            @{
                var s2 = new KPIS.GERP.WEB.GAMS.UserService.UserServiceClient();
                var u = s2.GetUsers();
                foreach(var us in u)
                { 
                    <a href="@Url.Action("SingleSigonRawData", new {username = us.Code, password = us.Password, redirectPage = ""})" class="alert alert-info" style="width:230px; float:left; margin-right: 10px;">
                        @us.Code <br/>
                        @(us.Employee != null ? us.Employee.FullName : "(no user)") <br/>
                        <span style="font-size: smaller">
                            @{
                                var positionName = us.Employee != null && us.Employee.Position != null && us.Employee.Position.Name  != null ? us.Employee.Position.Name : "";
                                positionName = positionName.Substring(0, Math.Min(44, positionName.Length));
                            }
                            
                            @positionName
                        </span>
                    </a>
                }
            } 
                                 
        </div><!--/.fluid-container-->
        

        

        <!--basic scripts-->

		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
		<script type="text/javascript">
			window.jQuery || document.write("<script src='Content/Ace/assets/js/jquery-1.9.1.min.js'>" + "<" + "/script>");
		</script>
        
        
        <!--For alert close-->
        
        <script src="~/Content/Ace/assets/js/bootstrap.min.js"></script> 
        <script src="~/Content/Ace/assets/js/bootstrap-datepicker.min.js"></script>
        <script src="~/Content/Ace/assets/js/chosen.jquery.min.js"></script>
        <script src="~/Content/Ace/assets/js/jquery.dataTables.min.js"></script>
        <script src="~/Content/Ace/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="~/Content/Ace/assets/js/ace-elements.min.js"></script>
        <script src="~/Content/Ace/assets/js/ace.min.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/bootstrap-datepicker.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/bootstrap-datepicker-thai.js"></script>
        <script src="~/Content/Ace/assets/js/date-time/locales/bootstrap-datepicker.th.js"></script>
        <script src="~/Content/Ace/assets/js/uncompressed/bootbox.js"></script>

         
        <!-- End -->
        
        

        <!--page specific plugin scripts-->

		<!--inline scripts related to this page-->

        <script type="text/javascript">
            function show_box(id) {
                $('.widget-box.visible').removeClass('visible');
                $('#' + id).addClass('visible');
            }

            window.onload = function () {
                document.getElementById("UserName").focus();
            };  
		</script>

    </body>
</html>
